home *** CD-ROM | disk | FTP | other *** search
/ Univers Interactif 3 / INTERACTIF.BIN / pc / planeten / internet / httpd4ma.sit / httpd4Mac-v12a folder / About httpd v12a next >
Text File  |  1995-02-28  |  16KB  |  313 lines

  1. ** httpd4Mac v12a **
  2.  
  3. Thank you for taking an interest in 'httpd4Mac' (for Macintosh) now at version ALPHA 1.2. 
  4. This program used to be called just 'httpd', but that caused some confusion, so I have 
  5. renamed it 'httpd4Mac'. 'httpd4Mac is a simple program that allows you to use your Mac as 
  6. a WWW server.
  7.  
  8. WARRANTY
  9.  
  10. This program is supplied free with absolutely no warranty and may do unthinkable damage
  11. to your machine or data, for which I will accept no liability. Having said that, I didn't write
  12. it to do that, but you must satisfy yourself it will not do any damage before using it.
  13.  
  14. You can do whatever you want with it except:-
  15.  
  16. - Distribute it without this file 'About httpd v12a'
  17. - Charge money for it (duplication/floppy costs excluded) 
  18.  
  19. ABOUT HTTPD
  20.  
  21. 'httpd4Mac' is an fba (Faceless Background Application) that implements a minimal http server.
  22. It currently supports the GET and HEAD methods, with full or simple requests. It ignores 
  23. 'Accept' fields from the client. NB The http spec does not allow such a thing as a simple 
  24. HEAD request. The only simple method is GET. But seeing as the CERN server accepts it (and
  25. the guy who invented WWW wrote that program) I thought I should also.
  26.  
  27. WHAT DOES THAT MEAN ?
  28.  
  29. That means it should work as a fairly straightforward WWW server. You should be able to write pages 
  30. with images, and have separate image, sound and movie files. What it does not (yet) support are
  31. clickable images or forms and other interactive pages. I may write the code to support this later
  32. but it is not planned at the moment. I have tried using MacWeb and X-Mosaic and X-Netscape to retreive pages and they appear to work OK.
  33.  
  34. A Faceless-Background-App (FBA or Background-Only-App (BOA) as the name suggests runs in the 
  35. background. When you launch it you will see it go grey, but it will not appear to have run.
  36. No menu will appear, nor will any windows. It will not appearin the application menu either.
  37. This is perfectly normal, but unless you set the prefs file to notify you about major events, 
  38. you will not know if it is running or not.
  39.  
  40. At some stage I may code a foreground version which will have a menu and text window. This 
  41. will not be available for some time though.
  42.  
  43. WHY HTTPD4MAC ?
  44.  
  45. There is one other http server I know of for the Mac which is not free. The aim of 'httpd4Mac' 
  46. is to provide a free http server, which implements enough to serve out pages on your mac,
  47. without it putting an enormous load on the machine. It is designed to be lightweight
  48. and fast.
  49.  
  50. It may not be much good if you expect to have loads of pages and images, or if you want to
  51. do more than just serve out static pages of HTML. At this stage I do not know how many pages
  52. and what sort of load it can reasonably handle. Perhaps someone could tell me how it fares.
  53.  
  54. It is not a port of either CERN's or NCSA's for UNIX. It does not use the common code library.
  55. The only reason I gave it a similar name was because I couldn't be bothered to think of a 
  56. diferent one.
  57.  
  58. MACHINE
  59.  
  60. You will need a Mac running at least Sys 7, with MacTCP version 2.xx an internet connection
  61. and preferably a hard disk. I think that should do it.
  62.  
  63. RUNNING IT
  64.  
  65. Just launch it. It will look for its config/prefs file firstly in its own folder, then in the 
  66. system/prefs folder. If it does not find it, it creates it own from default info and quits.
  67. This default prefs file can be edited to set up httpd4Mac how you want. The app will still 
  68. look 'greyed out' as if it is still running. This is normal. Just double click it again 
  69. when you wish to re-launch.
  70.  
  71. You will find this self-created prefs file in the preferences folder (within System folder) 
  72. You can place this prefs files in the same folder as httpd4Mac or leave it in the prefs folder. 
  73. I prefer keeping it with the app. Re-launch when you have edited the prefs file.
  74.  
  75. Use a text editor to edit the prefs file. There are comments within it to help you. It
  76. would probably help if you knew a bit about servers, http etc, but the sample prefs will work
  77. so if you know nothing except how to write WWW pages then you could just re-launch. Apologies
  78. for the fact that some of the configuration options don't work yet. Occasionally I refer to
  79. the prefs file as a config file, but I'll try to avoid that.
  80.  
  81. MORE ABOUT THE PREFS FILE DIRECTIVES
  82.  
  83. dnr - This option tells httpd4Mac to do a reverse DNS look up on each connection it receives when 
  84.       logging. If you are not logging this makes no difference. If this option is off the 
  85.       server may run a bit faster. If an error occurs, then only the IP number will be recorded.
  86.       Log info is actually queued while the client request is being serviced, the actual 
  87.       writing to a log file being deferred until later. Should httpd4Mac be forced to shut 
  88.       down beofre all logging is complete, it is rushed through without looking up names, so
  89.       you may find just a list of numbers occasionally at the end of the log file.
  90.  
  91. mime_def -
  92.    Allows you to associate siffices and/or Mac file Types with a MIME Type, read about 
  93.    MIME below.
  94.  
  95. create_access_log - 
  96.    Attempts to create a new log file each time httpd4Mac is launched. If it 
  97.    fails logging is disabled. If an old file exists it is renamed with a .bak extension. If this
  98.    renaming process fails then logging is disabled. If this option is off, then logging merely 
  99.    continues from the end of the old file if it exists.
  100.  
  101. ABOUT MIME
  102.  
  103. MIME stands for Multipurpose Internet Mail Extensions. While most operating Systems now revolve
  104. around the idea of a file as a basic unit of storage on a disk, none has really defined
  105. a standard way of identifying a particular file type or format. Various OS have their own 
  106. methods though. Apple incorporates a file type into the file header, meaning you can have
  107. any file name and change it, but the contents are still regarded by the OS as having not changed.
  108. UNIX users rely on file suffices (eg .html) and sad DOS users rely on 3-letter
  109. suffices (eg .htm) Mac users can also use suffices if they want.
  110.  
  111. The idea of MIME (I think) was to fill that gap and provide a OS-Independent method of 
  112. identifying information types, like GIF image files for instance. RFCs 1521 - 1524 describe
  113. MIME, but it was really meant not to be incorporated into OS, but used when transferring 
  114. files from machine to machine by E-Mail.
  115.  
  116. As the World Wide Web uses many different file types and should be almost platform independent
  117. I guess it may sense for the designers to choose MIME. In fact the http spec allows for 
  118. a MIME dialogue to take place between client and server, with the client saying 'I know about
  119. xxx format' and the server saying 'The file you are getting is xxx format'
  120.  
  121. The idea of the mime_def directive is for you to tell httpd4Mac what suffices and/or what 
  122. filetypes you are associating with what type of MIME format. Some examples are given in the 
  123. sample prefs file. When httpd4Mac receives a request it works its way through the list  of
  124. mime_def directives, until it finds a match. Unless you know exactly what type of Mac 
  125. file your scanner software produces, you may want to just stick with suffices. Mac text files
  126. always have a file type of 'TEXT' though. httpd4Mac alway slips in a default def  of 
  127. AnyFileType & AnySuffix = text/plain, for those types that do not match at the end of the list.
  128.  
  129. You can put a wildcard character (*) in the mime_def line to match against anything.
  130.  
  131. httpd4Mac converts all URLs it receives into lower case and then attempts to match to a MIME
  132. def. Make sure you suffices are in lower case !
  133.  
  134. NB There are some MIME types which have 'application' in them. You cannot use most of these with 
  135. httpd4Mac to deliver a Mac application to a client. This is because a Mac application uses 
  136. both the resource and data fork of the file, but httpd4Mac serves only the data fork. What 
  137. you have to do is convert the app to a bin-hex text file and define a MIME type that maps 
  138. .hqx to application/mac-binhex40.
  139.  
  140. MULTIPLE INSTANCES OF HTTPD4MAC
  141.  
  142. Just copy http4Macd for each 'server' you wish to run. Place the copies in separate folders and 
  143. create separate prefs files, also placing these in the folders. Set them up to run on different
  144. TCP ports and then launch them all. 
  145.  
  146. Make sure you set them up to serve on different TCP ports. Although it will not detect multiple 
  147. servers on the same port and will appear to run fine, you may get some unexpected results.
  148.  
  149. WWW FILES
  150.  
  151. httpd4Mac can potentially serve any file in the same folder as the app. This is the same if you 
  152. launch it by means of an alias (Say by putting an alias in the startup items folder), the files
  153. served will be only those in the same folderas the app. If the URL '/' is requested (ie 
  154. 'http://host.name/') httpd4Mac looks for the file 'home.html'.
  155.  
  156. '/' delimiters in the URL indicate sub-dirs in the usual manner (even though the specs say 
  157. the use of the same delimter as is used for UNIX directories is co-incidence)
  158.  
  159. You can happily use the '.' and '..' format for relative URLs, well, with the clients 
  160. I tried anyway. You cannot (yet) put folder aliases in the app folder to serve out files from
  161. elsewhere. All httpd4Mac understands at the moment is normal folders and files. It does not
  162. distinguish between text, sound, or image files, or by file type or creator, or suffix.
  163.  
  164. Make sure of course that sound/image files you serve out match what the client expects, the
  165. stadard format seems to be Sun ULaw sounds format and GIF image format.
  166.  
  167. HOW DO I WRITE WWW PAGES
  168.  
  169. If you don't know I'm not going to explain it here. There are places you can find out though.
  170. I would suggest looking in CERN's WWW pages as that is where it all started. Alternatively
  171. try NCSA (http://info.cern.ch/ or http://www.ncsa.uiuc.edu/)
  172.  
  173. WWW pages are actually just text file written in a language called HTML, and include pointers
  174. to the image and sounds files etc. These files can be local to the machine or served out from 
  175. a remote machine. Some client programs like MacWeb, come with local files written in HTML
  176. explaining how to set it up. These are often set up as the home page as default. You'll
  177. get an idea about HTML simply by looking at those files with a text editor.
  178.  
  179. LIKELY IMPROVEMENTS LEADING UP TO v13 (ROUGHLY IN ORDER OF IMPORTANCE)
  180.  
  181. - Error logging
  182. - Prevent serving out of logs and prefs file etc.
  183. - Clickable image support
  184. - Support for Finder aliases (+ maybe remote volumes)
  185.  
  186. POSSIBLE IMPROVEMENTS FOR A LATER RELEASE (ROUGHLY IN ORDER OF IMPORTANCE)
  187.  
  188. - Speed improvements
  189. - Various cache improvements
  190. - Understand client accept fields and act on them, maybe
  191. - Do prefs file syntax check
  192. - A version that runs in foreground and prints log output to a window.
  193. - A configuration program with proper User Interface to allow easy configuration. May allow 
  194.   remote changing of configuration by Program Linking.
  195.  
  196. WHAT IT MAY NEVER DO.... (Depends if I can be bothered)
  197.  
  198. - Support Applescript or anything that might be needed for interactive pages ie
  199.   Search Functions
  200.  
  201. - Support additional methods.(eg POST for fill out forms)
  202.  
  203. MEMORY PARTITION
  204.  
  205. The partition is set at 500K. In fact httpd4Mac may run in a partition
  206. of ~200K + size of largest file expected to be served out by httpd4Mac. ie If you have a 
  207. 100K image file that can be accessed, then the partition should be at least 300K. It may 
  208. run with considerably less though. The memory requirements can depend on many variables.
  209.  
  210. The best way to find out the ideal partition size is to start httpd4Mac with the debug 
  211. option on with verbose messages, then force it to quit immediately. If you do not have 
  212. a process management utility, then just restart your Mac. When you examine the debug log 
  213. file you will see some lines showing a memory analysis. As long as there is enough free 
  214. memory to hold the largest file you expect to serve, plus a bit spare (say 10%/5K which
  215. ever is larger, this will probably do. However you will get better results the more memory 
  216. you allocate.
  217.  
  218. UNEXPECTED FEATURES
  219.  
  220. 1. Make sure the multifinder partition is big enough (see memory above). Because httpd 
  221. caches objects retrieved it need a certain amount of memory to do that. Objects cannot be
  222. cached in bits they have to be cached whole. This is why the size of the biggest object that
  223. be served out comes into the equation for determining the memory partition. This may be 
  224. fixed in the future. Failure to do this may give strange results or crashes.
  225.  
  226. 2. At present there is nothing to stop you reuqesting the debug info or prefs file (or even 
  227. httpd4Mac itself !). Such action might have some very weird if not dangerous results, I would 
  228. not recommend it.
  229.  
  230. 3. httpd4Mac takes a little time to get going. Usually access is not possible until about 10 seconds 
  231. or so after start-up. The reason is because httpd4Mac relinquishes control ASAP, the idea being
  232. if it is in your startup items folder, the boot process does not appear to be slowed down by it.
  233.  
  234. 4. httpd4Mac uses a crude caching mechanism to store files that have previously been requested. 
  235. Basically an item is cached until the copy is a certain age, no check is made to see if the file
  236. has changed. This is fine if you do not change the pages pages often, but if you do you may 
  237. wish to set this lifetime to a lower value. A better caching system will be in future versions.
  238. The cache life is controlled in the prefs file.
  239.  
  240. ABOUT THE CODE DEVELOPMENT
  241.  
  242. This is my first TCP programme. It was developed on Think C v6. I made use of some 
  243. utilities, which you also find useful if you have any problems
  244.  
  245. MacsBug        - Apples low level debugger
  246. ZapTCP         - Apple extension, helps when TCP apps crash unexpectedely
  247. MacTCPwatcher  - Utility from Peter Lewis for testing MacTCP functions
  248. ZoneRanger     - Utility from Joshua Golub, used for examing memory
  249. ProcessFinder  - Utility from Edward Harp, used to kill the background app without rebooting
  250.  
  251. I will release the source code for this app later, when I have had a chance to tidy it
  252. up a bit.
  253.  
  254. It was developed on a Mac IIci, running Sys 7.1, MacTCP 2.0.4, with 20Meg of RAM. You 
  255. won't need that much though. It will not run on a 68000 machine. It does not use any 
  256. floating point code. It has also been run (although not for very long) on a Centris
  257. 610, again Sysy 7.1, MacTCP 2.0.4
  258.  
  259. FIXES/IMPROVEMENTS FROM 1.0a TO 1.1a (Released 17 Jan 1995)
  260.  
  261. - You now get a notification telling you when httpd is running and ready for access.
  262. - An option to limit the life of cached items is now in the prefs file.
  263. - Bug fixed that meant if you requested a URL with lower 'ASCII-value' than the first
  264.   request of the day it crashed. By ASCII-value I mean comparing the ASCII values of 
  265.   the individual characters as you would if you were sorting alphabetically.
  266.   ie 'bug' < 'home' and 'help' < 'home'
  267.  
  268. FIXES/IMPROVEMENTS FROM 1.1a TO 1.2a (Released 28 Feb 1995)
  269.  
  270. - A bug that caused a bus error when httpd4Mac quits is gone.
  271. - HEAD method is now supported
  272. - MIME support
  273. - Access logging is done, with DNS lookup if needed.
  274. - URLs are no longer case sensitive.
  275. - Change of format of debugging file, more messages added. Each line now peceeded with 
  276.   function name
  277. - Some general improvements in the way some things are done.
  278.  
  279. NEW VERSIONS
  280.  
  281. I will always place new versions on the info-mac archives at Stanford. I do not plan to 
  282. post them elsewhere yet, so latest copies can be obtained there. 
  283.  
  284. COMMENTS/PROBLEMS
  285.  
  286. httpd4Mac is my first piece of freeware and I would be pleased to know it is being used at all. 
  287. Please send me any comments you have. Of course useful comments that would lead to bug fixing
  288. would be appreciated. I always read my E-Mail and I usually reply. You can always send me 
  289. a postcard. However if I get loads of E-Mail, I may not be able to reply. It may be better
  290. to post on USENet. I often read comp.sys.mac.comm, plus c.s.m.programmer and sometimes post.
  291.  
  292. I rarely read newsgroups about WWW.
  293.  
  294. I have sometimes referred to this program as shareware, sorry if that has caused confusion. It
  295. is freeware, you have no obligation to me regardless of what you want to use it for, but it 
  296. would be nice to hear from you.
  297.  
  298. Bill Melotti
  299. Rm2.09, R68
  300. Rutherford Appleton Laboratory
  301. Chilton, Nr Didcot
  302. OXON
  303. OX11  OQX
  304. UNITED KINGDOM
  305. --------------------------------
  306.  
  307. Bill Melotti 28 Feb 1995
  308.  
  309.  
  310. bill.melotti@rl.ac.uk
  311.  
  312.  
  313. -- End of file --